package com.atsansan.mywork.login.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author sansan
 * @create 2021-01-17 22:35
 */
@Configuration
public class MyMvcConfig extends WebMvcConfigurerAdapter {

    @Bean
    public WebMvcConfigurerAdapter webMvcConfigurerAdapter(){
        WebMvcConfigurerAdapter adapter = new WebMvcConfigurerAdapter() {

            @Override
            public void addViewControllers(ViewControllerRegistry registry) {
//                registry.addViewController("/").setViewName("login");
                registry.addViewController("/").setViewName("index1");
                registry.addViewController("/login").setViewName("login");
                registry.addViewController("/index.html").setViewName("login");
                registry.addViewController("/regist").setViewName("regist");
                registry.addViewController("/error").setViewName("error");
                registry.addViewController("/index2").setViewName("index2");
                registry.addViewController("/login_success").setViewName("login_success");
                registry.addViewController("/error1").setViewName("error1");
                registry.addViewController("/select").setViewName("select");
                registry.addViewController("/error2").setViewName("error2");
                registry.addViewController("/error3").setViewName("error3");
            }
        };
        return adapter;
    }
}
